﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 计算器窗体应用
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            double num1 = Double.Parse(textBox1.Text);
            double num2 = Double.Parse(textBox3.Text);
            string s1 = comboBox1.Text;
            switch (s1)
            {
                case "+":
                    label4.Text = (num1 + num2).ToString();
                    break;
                case "-":
                    label4.Text = (num1 - num2).ToString();
                    break;
                case "*":
                    label4.Text = (num1 * num2).ToString();
                    break;
                case "/":
                    if (num2 == 0)
                        label4.Text = "wrong";
                    else
                        label4.Text = (num1 / num2).ToString();
                    break;
                case "%":
                    label4.Text = (num1 % num2).ToString();
                    break;
                default:
                    label4.Text = "wrong";
                    break;

            }
        }
    }
}
